Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint(). #419

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JonEckenrode
Copy link

Updated snippet for window size class documentation.

@JonEckenrode JonEckenrode changed the title Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpo… Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint(). Dec 11, 2024
@@ -52,9 +51,9 @@ fun MyApp(
windowSizeClass: WindowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
) {
// Perform logic on the size class to decide whether to show the top app bar.
val showTopAppBar = windowSizeClass.windowHeightSizeClass != WindowHeightSizeClass.COMPACT
val showTopAppBar = windowSizeClass.isHeightAtLeastBreakpoint(480)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the built-in constant in androidx.window: https://developer.android.com/reference/androidx/window/core/layout/WindowSizeClass?hl=en#HEIGHT_DP_MEDIUM_LOWER_BOUND()

Suggested change
val showTopAppBar = windowSizeClass.isHeightAtLeastBreakpoint(480)
val showTopAppBar = windowSizeClass.isHeightAtLeastBreakpoint(WindowSizeClass.HEIGHT_DP_MEDIUM_LOWER_BOUND)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants